from openpyxl import load_workbook # 导包

class excel():
    def __init__(self,path,sheetname):
        self.path = load_workbook(path)
        self.sheetname = self.path[sheetname]

    # 封装读取excel
    def read_excel(self):
        list = []
        for line in self.sheetname:
            newlist = []
            newlist.append(line[0].value)
            newlist.append(line[1].value)
            list.append(newlist)
        # list.pop(0)
        return list

if __name__ == '__main__':
    path = r'D:\zhuanwu\zhuangao5_2\Unit_09\baidu.xlsx'
    sheetname = 'Sheet1'
    dy = excel(path,sheetname)
    print(dy.read_excel())
